using System;
using System.Collections.Generic;
using System.Text;
using EnsoNetServer;

namespace EnsoNetSamples
{
    public class SampleCommands : MarshalByRefObject, ICommandlet
    {
        public Command[] GetCommands()
        {
            return new Command[] { 
                // Command handled by a method.
                new Command("echo {message}", "Echoes a typed message", "<p>Echoes a typed message</p>", EchoCommand),
                // Inline delegate.
                new Command("bleep", "", "", PostfixType.None, delegate(IEnso enso, string m, string p) { enso.DisplayMessage("bleep"); })
            };
        }

        public void EchoCommand(IEnso enso, string command, string postfix)
        {
            switch (command)
            {
                case "echo {message}": enso.DisplayMessage("<p>" + postfix + "</p>"); break;
            }
        }
    }
}
